﻿Imports System.Data.SqlClient

Public Class clsAsignacionBiometria
    Private mintIdBiometria As Integer
    Private mintIdEmpleado As Integer
    Private mstrNombreUsuario As String
    Public Property IdBiometria() As Integer
        Get
            Return mintIdBiometria
        End Get
        Set(ByVal value As Integer)
            mintIdBiometria = value
        End Set
    End Property
    Public Property IdEmpleado() As Integer
        Get
            Return mintIdEmpleado
        End Get
        Set(ByVal value As Integer)
            mintIdEmpleado = value
        End Set
    End Property
    Public Property NombreUsuario() As String
        Get
            Return mstrNombreUsuario
        End Get
        Set(ByVal value As String)
            mstrNombreUsuario = value
        End Set
    End Property
    Public Sub New()
        mintIdBiometria = 0
        mintIdEmpleado = 0
        mstrNombreUsuario = ""
    End Sub
    Public Sub Insertar()
        Dim sql As String = "Insert Into AsignacionBiometria (" & _
                            "IdEmpleado," & _
                            "NombreUsuario)" & _
                            "VALUES (" & _
                            "@IdEmpleado," & _
                            "@NombreUsuario)"
                           

        Dim cnConn As New SqlConnection
        cnConn.ConnectionString = CitraConnection

        Dim Command As New SqlCommand(sql, cnConn)

        Command.Parameters.AddWithValue("IdEmpleado", mintIdEmpleado)
        Command.Parameters.AddWithValue("NombreUsuario", mstrNombreUsuario)

        cnConn.Open()
        Dim RowsAffected As Integer = Command.ExecuteNonQuery

        If RowsAffected > 0 Then
            cnConn.Close()
        Else
            MsgBox("No fue posible insertar la Liquidacion ", MsgBoxStyle.Exclamation, "Aviso")
            If cnConn.State = ConnectionState.Open Then
                cnConn.Close()
            End If
        End If
    End Sub
End Class
